package com.example.activitytest_1;


import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.activitytest_1.bean.Student;
import com.example.activitytest_1.bean.Teacher;

import java.util.ArrayList;

public class SecondActivity extends AppCompatActivity {
    private TextView mText;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        Intent intent = getIntent();
        mText = findViewById(R.id.text);
        mText.setText(intent.getStringExtra("name"));
        Log.e("test111", "=========onCreate=========");
        Log.e("test111", "=========boolean========="+intent.getBooleanExtra("boolean",false));
        Log.e("test111", "=========byte========="+intent.getByteExtra("byte",(byte)0));
        Log.e("test111", "=========char========="+intent.getCharExtra("char", '1'));
        Log.e("test111", "=========short========="+intent.getShortExtra("short",(short)0));
        Log.e("test111", "=========int========="+intent.getIntExtra("int",0));
        Log.e("test111", "=========long========="+intent.getLongExtra("long",0L));
        Log.e("test111", "=========float========="+intent.getFloatExtra("float",0.0F));
        Log.e("test111", "=========double========="+intent.getDoubleExtra("double",0.0));
        Bundle bundle =intent.getBundleExtra("bundle");
        Log.e("test111", "=========bundle boolean========="+bundle.getBoolean("boolean"));
        Log.e("test111", "=========bundle int========="+bundle.getInt("int"));

        int[] array =intent.getIntArrayExtra("array");
        for (int i :array){
            Log.e("test1111","==========array==========="+i);
        }
       ArrayList<String> list=intent.getStringArrayListExtra("list");
        for (String s:list){
            Log.e("test1111","========list========="+s);
        }

        Student student= (Student) intent.getSerializableExtra("student");
        Log.e("test1111","========student========="+student.toString());

        Teacher teacher=intent.getParcelableExtra("teacher");
        Log.e("test1111","=======teacher======="+teacher.toString());
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.e("test111", "=========onStart=========");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.e("test111", "=========onRestart=========");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.e("test111", "=========onResume=========");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.e("test111", "=========onPause=========");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.e("test111", "=========onStop=========");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.e("test111", "=========onDestroy=========");
    }
}